package com.yyx.lgb.common.exception;

import com.yyx.lgb.model.vo.common.Result;
import com.yyx.lgb.model.vo.common.ResultCodeEnum;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

//统一异常处理类
@ControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(value = LgbException.class)
    @ResponseBody
    public Result error(LgbException exception){
        exception.printStackTrace();
        return Result.build(null,exception.getResultCodeEnum());
    }
}
